const TOKEN_KEY = "admin-token";
const USERINFO_KEY = "admin-userInfo";
const USERROUTER_KEY = "admin-router";

function getToken(): string {
    return localStorage.getItem(TOKEN_KEY) || "";
}

function setToken(token: string) {
    return localStorage.setItem(TOKEN_KEY, token);
}

function clearToken() {
    return localStorage.removeItem(TOKEN_KEY);
}

function getUserInfo(): string {
    return localStorage.getItem(USERINFO_KEY) || "";
}

function setUserInfo(user: string) {
    return localStorage.setItem(USERINFO_KEY, user);
}

function clearUserInfo() {
    return localStorage.removeItem(USERINFO_KEY);
}

function setUserRouter(user: string) {
    return localStorage.setItem(USERROUTER_KEY, user);
}

function getUserRouter(): string {
    return localStorage.getItem(USERROUTER_KEY) || "";
}

function clearUserRouter() {
    return localStorage.removeItem(USERROUTER_KEY);
}

export {
    getToken,
    setToken,
    clearToken,
    getUserInfo,
    setUserInfo,
    clearUserInfo,
    setUserRouter,
    getUserRouter,
    clearUserRouter
};
